<!DOCTYPE html>
<html lang="ja">
<head>
	 {{$pc_meta}}
	<!-- stylesheets -->
	<link rel="stylesheet" href="pc/assets/css/main.css" media="screen">
	<link rel="stylesheet" href="pc/assets/css/print.css" media="print">

	<!-- javascript -->
	<script src="pc/assets/js/html5shiv-printshiv.js" type="text/javascript"></script>
	<script src="pc/assets/js/search_txt.js" type="text/JavaScript"></script>
	<script src="pc/assets/js/func.js" type="text/JavaScript"></script>
	<script src="pc/assets/js/jquery-1.7.2.js" type="text/javascript"></script>
	<script src="/__utm.js" type="text/javascript"></script>
	<!--[if lt IE 9]>
		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<script src="pc/assets/js/DOMAssistantCompressed-2.8.1.js" type="text/javascript"></script>
		<script src="pc/assets/js/selectivizr-min.js" type="text/javascript"></script>
		<script src="pc/assets/js/selectivizr.js" type="text/javascript"></script>
	<![endif]-->
<script type="text/javascript">
function parseNum(s)
{
    s = String(s);
    return Number(s.replace(/\,/g,""));
}

function formatNum(strNum)
{
    strNum = String(strNum);
    if (strNum.length <= 3) {

        return strNum;

    }

    if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(strNum)) {

        return strNum;

    }

    var a = RegExp.$1, b = RegExp.$2, c = RegExp.$3;

    var re = new RegExp();

    re.compile("(\\d)(\\d{3})(,|$)");

    while (re.test(b)) {

        b = b.replace(re, "$1,$2$3");

    }
    return a + "" + b + "" + c;

}


function changeNum(goodid)
{

	changecart();
}
function changecart()
{

	var temp_shopjp_cart="";
	for(var i=0;i<Number($("#rowbody").attr("rowcount"));i++)
	{
		if($("#tr_"+i).length>0)
		{
			var gid=$("#tr_"+i).attr("goodid");
			var gnum=$("#orderNum_"+i).val();
			if(temp_shopjp_cart=="")
			{
				temp_shopjp_cart=gid+"-"+gnum;
			}
			else
			{
				temp_shopjp_cart =temp_shopjp_cart+"|"+gid+"-"+gnum;
			}
			$("#errmsg_"+gid).html("");
		}
	}
	$.ajax({url:"{{'pc/Cart/ajaxsetcart'|U}}",type:"POST",async:false,data: "shopjpcart="+temp_shopjp_cart,
		success: function(msg){
		     if(msg!="cart ajax success")
		    	 {
		    	 eval(msg);
		    	 }
		     	else
		    	 {

		    		refreshSum();
		    	 }
		   },
			error:function()
			{
				eval(msg);
			}
	})
	return true;

}

function deleterow()
{
	for(var i=0;i<Number($("#rowbody").attr("rowcount"));i++)
	{
		if($("#tr_"+i).length>0)
		{
			if($("#chk_"+i).prop("checked"))
			{
			$("#tr_"+i).remove();
			}
		}

	}
	 changecart();
}

function refreshSum()
{
	var sumprice=0;
	var count=0;
	for(var i=0;i<Number($("#rowbody").attr("rowcount"));i++) {
	  
		if($("#sumPrice_"+i).length >0)
		{
			count++;
			
        $("#sumPrice_" + i).html(formatNum(parseNum($("#price_" + i).html()) * parseNum($("#orderNum_" + i).val())));
        sumprice += parseNum($("#sumPrice_" + i).html());
		}


    }
    $("#allSumPrice").html(formatNum(sumprice));
	$("#orderSumPrice").html(formatNum( parseNum($("#allSumPrice").html())    ));
	if(count==0){
		$("[nogoods='hide']").hide();
		$("#nogood_msg").html("カゴの中には何もはいっていません");
	}
}

</script>
</head>

<body id="thisbody">
	<div id="wrapper">

		<noscript>このサイトはJavaScriptがオンになっていないと正常に表示されません</noscript>

		{{$pc_head}}
<center><span style="color:red;">{{$errmsg}}</span></center>
		<ol id="pan">
			<li><a href="{{'pc/Top/index'|U}}">ホーム</a></li>
			<li>買い物カゴ</li>
		</ol>

		<section id="main">
			<div id="main_inner">
				<div id="top_detail">
					<div id="cart">
						<h1>買い物カゴ</h1>

						<ul>
							<li>ご注文いただいた商品を表示しています。</li>
							<li>買い物に戻る場合は、【お買い物に戻る】ボタンを押してください。</li>
							<li>数量を変更する場合は、数量入力エリアに数量を入力して入力フォームの横の  ボタンを押してください。</li>
							<li>ご注文をされる場合は、【お会計に進む】ボタンでご注文手続きを開始してください。</li>
						</ul>

						<h2>ご注文内容</h2>
						<form name="cart" id="form_cart" action="/shop/cart/" method="post" target="_top">
							<div id="cart_detail">
							<span id="nogood_msg"></span>
								<table border="0" cellpadding="0" cellspacing="1"  nogoods="hide">
									<thead>
										<tr>
											<th>商品名（商品コード）</th>
											<th>数量</th>
											<th>小計</th>
											<th class="delete">削除</th>
										</tr>
									</thead>
									<tbody id="rowbody" rowcount="{{$good_data|@count}}">
									{{foreach name=goodloop from=$good_data item=i}}
										<tr  id="tr_{{$smarty.foreach.goodloop.index}}" goodid="{{$i.id}}">
											<td class="goods">
												<a href="pc_topItem_index.html?id={{$i.id}}"><img src="{{$i.goods_image}}" alt="{{$i.goods_name}}"></a>
												<a href="pc_topItem_index.html?id={{$i.id}}">{{$i.goods_name}}</a><br>
												<p class="price">¥<span id="price_{{$smarty.foreach.goodloop.index}}" >{{$i.goods_unitprice|number_format}}</span></p>
											</td>
											<td align="center">
												<input type="text" id="orderNum_{{$smarty.foreach.goodloop.index}}"  value="{{$i.orderNum}}" size="3">
												<input type="image" onclick="changeNum({{$smarty.foreach.goodloop.index}});return false;" name="selectMethod[update]" src="pc/assets/images/btns/btn_cart_reload.gif" width="22" height="22" title="このボタンをクリックするとカーとの中身を更新します" align="absmiddle">
												<br><span  style="color:red;" id="errmsg_{{$i.id}}"></spans>
											</td>
											<td class="price">¥<span id="sumPrice_{{$smarty.foreach.goodloop.index}}">{{$i.orderNum*$i.goods_unitprice|number_format}}</span></td>
											<td class="delete"><input type="checkbox" id="chk_{{$smarty.foreach.goodloop.index}}"  value="1"></td>
										</tr>
										{{/foreach}}
									</tbody>
									<tfoot>
										<tr>
											<td>&nbsp;</td>
											<td class="txt">商品合計</td>
											<td class="price"  >¥<span id="allSumPrice"></span></td>
											<td class="delete"><input type="image" onclick="deleterow();return false;" src="pc/assets/images/btns/btn_cart_delete.gif" width="43" height="23" alt="チェックした商品を全て削除"></td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td class="txt">送料(手数料)</td>
											<td class="price">別途</td>
											<td class="delete">&nbsp;</td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td class="txt2">合計額</td>
											<td class="price2" >¥<span id="orderSumPrice"></span></td>
											<td class="delete">&nbsp;</td>
										</tr>
									</tfoot>
								</table>

								<dl  >
									<dt><a href="{{'pc/Top/index'|U}}" title="お買い物に戻る">お買い物に戻る</a></dt>
									<dd ><input id="btnnext" nogoods='hide' type="button" name="selectMethod[next]"  onclick="location.href='{{'pc/Order/index'|U}}'" title="お会計に進む"></dd>
								</dl>
								<script type="text/javascript">refreshSum();</script>
								<br clear="all">
							</div>
						</form>
					</div>

					<div id="cart_recommend">
						<h3>あなたにおすすめの書籍</h3>
					    <script language="JavaScript" type="text/javascript" charset="UTF-8">script = document.createElement("script");script.setAttribute("type", "text/javascript");script.setAttribute("language", "JavaScript");script.setAttribute("charset", "UTF-8");script.setAttribute("src", document.location.protocol + "//rc.kotoha.co.jp/js/kotohaco_rsWidget.js");tmp = document.createElement("div");tmp.appendChild(script);document.write(tmp.innerHTML);</script><script language="JavaScript" type="text/javascript" charset="UTF-8">var queryopt = new Array();
                        //レコメンド方式: 関連商品(タイプ2)
                        //itemidを指定します。指定されたitemidの商品に関連する商品を表示します。itemidはセミコロン区切りで最大10件まで設定可能です。
                        //例：itemid = "X490352;X490863";
                        itemid = "200339";

                        k_callRs("dental-diamond","kotohaco_recoview","relation2",'itemid='+itemid,rsView,{ "layout": "table|cols=5|rows=1", "maxitems": "10", "pagenav": "1", "viewitems": ["image|type=image|link=1|size=0|alt=title", "title|type=text|link=1|maxlen=0", "data1|type=text|link=0|maxlen=0", "itemid|type=text|link=0|maxlen=0"], "link_target": "", "replaceprotocol_link": "1", "replaceprotocol_image": "1"},[[".kotohaco_rsview_itemwindow table td", "width:20%;height:100%;"], [".kotohaco_rsview_itemwindow ol", "margin:0; padding:0;list-style-type:none;width:100%;"], [".kotohaco_rsview_itemwindow table", "width:100%;"], [".kotohaco_rsview_item", "text-align:center; vertical-align: top; padding: 5px;"], [".kotohaco_rsview_item div", "margin-bottom:2px 0px;"], [".kotohaco_rsview_title", "border-bottom: medium #CCCCCC solid; border-left: thick #CCCCCC solid; padding: 5px; margin: 5px 0px;"], [".kotohaco_rsview_footer", "border-top: thin #CCCCCC solid; padding: 2px; font-size:10px; text-align:right; margin: 2px 0px;clear:both;"], [".kotohaco_rsview_pagenav .pagenav_back", "float:left; text-align:left"], [".kotohaco_rsview_pagenav .pagenav_next", "float:right; text-align:right"], [".kotohaco_rsview_pagenav", "text-align:center; clear:both;"]],queryopt);
                        </script>
						<br clear="all" />
					</div>
				</div>
			</div>
		</section>

		<section id="r_clm">
			<h4 class="begginer">はじめてのお客様へ</h4>
			<ul id="begginer">
				<li><a href="">商品のお届けについて</a></li>
				<li><a href="">お支払い方法について</a></li>
				<li><a href="">代金引換について</a></li>
				<li><a href="">カード決済について</a></li>
				<li><a href="">返品交換について</a></li>
			</ul>

			<h4>Information</h4>
			<ul id="info">
				<li><a href="">ご利用案内</a></li>
				<li><a href="">求人案内</a></li>
				<li><a href="">図書取扱店</a></li>
				<li><a href="">トピックス</a></li>
				<li><a href="">販売支援</a></li>
				<li><a href="">会社概要</a></li>
				<li><a href="">お問い合せ</a></li>
			</ul>


             {{$chartsing}}
			<script src="https://seal.verisign.com/getseal?host_name=www.dental-diamond.co.jp&size=M&use_flash=YES&use_transparent=YES&lang=ja"></script>
		</section>
		<br clear="all">

		{{$pc_foot}}

	</div>
</body>
</html>